<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">

    <ui:composition template="layout.xhtml">
        <ui:define name="body">
            <div class="section">
                <h1>Mensagem</h1>
                <h:form>
                    <div class="container_24">
                        <p:menu styleClass="grid_6">  
                            <p:submenu label="MENU" >  
                                <p:menuitem value="Caixa da Entrada" url="inbox.xhtml" icon="ui-icon-mail-closed" />  
                            </p:submenu>  
                        </p:menu>  
                        <p:panel header="De : #{managerMessage.message.userFrom.name}" style="float: left;min-height: 600px;" styleClass="grid_17"  >
                        <p:outputLabel value="#{managerMessage.message.text}" styleClass="grid_17" style="text-align: left;line-height: 1.3em" />

                            <h:outputText value="#{managerMessage.message.dateMessage}" style="font-weight: bold;text-align: right;float: right;" styleClass="grid_7">
                            <f:convertDateTime pattern="dd/MM/yyyy - HH:mm" />
                        </h:outputText>
                        <div class="clear"/>

                        <p:commandButton update="@form" title="Abrir Venda"
                                         value="Visualizar Venda"
                                         style="float : right "
                                         rendered="#{managerMessage.hasSale}"
                                         actionListener="#{managerInbox.openSale(managerMessage.message.sale)}"
                                         icon="ui-icon-mail-open" />
                        <div class="clear"/>
                        <p:outputLabel value="Histórico da Venda"  rendered="#{managerMessage.hasSale}" style="font-weight: bold;margin: 15px 0px 0px 5px;"/>
                        <div class="clear"/>
                        <p:dataTable value="#{managerSearchSale.pendingsBySale(managerMessage.message.sale)}" var="p"
                                             styleClass="grid_24"
                                             rendered="#{managerMessage.hasSale}"
                                             emptyMessage="Nenhum registro">  
                            <p:column headerText="Descrição" width="250">  
                                        <h:outputText value="#{p.description}" />
                                    </p:column>  
                            <p:column headerText="Pendência" style="400">  
                                        <h:outputText value="#{p.statusSale.name}" styleClass="#{p.statusSale}" style="font-weight: normal" />
                                    </p:column>
                                    <p:column headerText="Data">  
                                        <h:outputText value="#{p.dataPendencia}">
                                            <f:convertDateTime locale="pt_BR" pattern="dd/MM/yyyy - HH:mm"/>  
                                        </h:outputText>
                                    </p:column>
                                </p:dataTable>

                        </p:panel>
                    </div>
                </h:form>
            </div>
        </ui:define>
    </ui:composition>
</html>
